package com.hl.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hl.sfzy.entity.Reply;
import com.hl.sfzy.mapper.ReplyMapper;
import com.hl.sfzy.service.ReplyService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReplyServiceImpl implements ReplyService {
	@Autowired
	private ReplyMapper replyMapper;

	@Override
	public int add(Reply reply) {
		int add = replyMapper.Insert(reply);
		return add;
	}

	@Override
	public int edit(Reply reply) {
		int edit = replyMapper.Update(reply);
		return edit;
	}

	@Override
	public int remove(Integer reqlyId) {
		int remove = replyMapper.Delete(reqlyId);
		return remove;
	}

	@Override
	public int removeBatch(Integer[] reqlyIds) {
		int removeBatch = replyMapper.DeleteBatch(reqlyIds);
		return removeBatch;
	}

	@Override
	public PageInfo<Reply> findByPage(int pageNum, int pageSize, Reply reply) {
		PageHelper.startPage(pageNum,pageSize);
		List<Reply> list = replyMapper.Select(reply);
		PageInfo<Reply> pageInfo = new PageInfo<>(list);
		return pageInfo;
	}

	@Override
	public List<Reply> find() {
		List<Reply> find = replyMapper.Select();
		return find;
	}

	@Override
	public Reply findById(Integer reqlyId) {
		Reply findById = replyMapper.SelectById(reqlyId);

		return findById;
	}
}
